<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>wwwApp: user/profile.php File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">wwwApp
   </div>
   <div id="projectbrief">A web app for workshop organizing, recruitment and qualification</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.1.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_111cd2f11cffd6d6d28d89ee0389ee9e.html">user</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">profile.php File Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p><a href="profile_8php_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a0c599d4d650d9e6be9ff83f387f2a54a"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="profile_8php.html#a0c599d4d650d9e6be9ff83f387f2a54a">getAvatarPath</a> ($uid=null)</td></tr>
<tr class="memitem:aff9daec7313da1b26885ec722adb53e2"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="profile_8php.html#aff9daec7313da1b26885ec722adb53e2">actionShowProfile</a> ($uid=null)</td></tr>
<tr class="memitem:a0e394e32f8c12de6f267b12957a3c219"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="profile_8php.html#a0e394e32f8c12de6f267b12957a3c219">actionEditProfile</a> ($uid=null)</td></tr>
<tr class="memitem:a91891599d32d0aa284d8690d6f0e090e"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="profile_8php.html#a91891599d32d0aa284d8690d6f0e090e">actionHandleAvatarUpload</a> ()</td></tr>
<tr class="memitem:aa3f448ae5d33ace19fe4b1d30bbc73ba"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="profile_8php.html#aa3f448ae5d33ace19fe4b1d30bbc73ba">actionEditAdditionalInfo</a> ($uid=null)</td></tr>
<tr class="memitem:ad603b73d651c86d7ae2bf48c936712cc"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="profile_8php.html#ad603b73d651c86d7ae2bf48c936712cc">actionEditMotivationLetter</a> ()</td></tr>
<tr class="memitem:a6e25cefab90ef44a1ae9cbfb47ad4f22"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="profile_8php.html#a6e25cefab90ef44a1ae9cbfb47ad4f22">getGraduationYearOptions</a> ($withComment=false)</td></tr>
</table>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="aa3f448ae5d33ace19fe4b1d30bbc73ba"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">actionEditAdditionalInfo </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$uid</em> = <code>null</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="profile_8php_source.html#l00280">280</a> of file <a class="el" href="profile_8php_source.html">profile.php</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global $USER, <a class="code" href="common_8php.html#a7dc56dc8b18ad37272b56fa7395bedef">$DB</a>, <a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>;</div>
<div class="line">        $edition = <a class="code" href="utils_8php.html#a86acce3c002ca1af709fd1b04f2f82fa">getOption</a>(<span class="stringliteral">&#39;currentEdition&#39;</span>);</div>
<div class="line">        $admin = !is_null($uid) &amp;&amp; $uid != $USER[<span class="stringliteral">&#39;uid&#39;</span>];</div>
<div class="line">        <span class="keywordflow">if</span> ($admin)</div>
<div class="line">        {</div>
<div class="line">                <span class="keywordflow">if</span> (!<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;adminUsers&#39;</span>))  <span class="keywordflow">throw</span> <span class="keyword">new</span> <a class="code" href="classPolicyException.html">PolicyException</a>();</div>
<div class="line">                $uid = intval($uid);</div>
<div class="line">        }</div>
<div class="line">        <span class="keywordflow">else</span></div>
<div class="line">        {</div>
<div class="line">                <span class="keywordflow">if</span> (!<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;editAdditionalInfo&#39;</span>))  <span class="keywordflow">throw</span> <span class="keyword">new</span> <a class="code" href="classPolicyException.html">PolicyException</a>();</div>
<div class="line">                $uid = intval($USER[<span class="stringliteral">&#39;uid&#39;</span>]);</div>
<div class="line">        }</div>
<div class="line"></div>
<div class="line">        $r = $DB-&gt;users[$uid]-&gt;assoc(<span class="stringliteral">&#39;pesel,address,telephone,parenttelephone,gatherplace,tshirtsize,comments,name&#39;</span>);</div>
<div class="line"></div>
<div class="line">        $PAGE-&gt;title = _(<span class="stringliteral">&#39;Additional info&#39;</span>);</div>
<div class="line">        <span class="keywordflow">if</span> ($admin)  $PAGE-&gt;title = $r[<span class="stringliteral">&#39;name&#39;</span>] .<span class="stringliteral">&#39; - &#39;</span>. $PAGE-&gt;title;</div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">if</span> (<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;adminUsers&#39;</span>))</div>
<div class="line">                $PAGE-&gt;headerTitle = <a class="code" href="admin_8php.html#a9cfe349e8c7f62fd2a38c48f80b90028">getUserHeader</a>($uid, $r[<span class="stringliteral">&#39;name&#39;</span>], <span class="stringliteral">&#39;editAdditionalInfo&#39;</span>);</div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">if</span> (!$DB-&gt;edition_users($edition, $uid)-&gt;count())</div>
<div class="line">        {</div>
<div class="line">                <span class="keywordflow">if</span> ($admin)</div>
<div class="line">                        $PAGE-&gt;addMessage(_(<span class="stringliteral">&#39;The user hasn\&#39;t signed up for this edition yet.&#39;</span>));</div>
<div class="line">                <span class="keywordflow">else</span></div>
<div class="line">                        $PAGE-&gt;addMessage(_(<span class="stringliteral">&#39;You should first sign up as a participant or lecturer.&#39;</span>));</div>
<div class="line">                <span class="keywordflow">return</span>;</div>
<div class="line">        }</div>
<div class="line"></div>
<div class="line">        $inputs = <a class="code" href="utils_8php.html#ae70693a7d9a8484219fe57bdf2d2a46f">parseTable</a>(<span class="stringliteral">&#39;</span></div>
<div class="line"><span class="stringliteral">                NAME            =&gt; TYPE;     tDESCRIPTION;                                         VALIDATION</span></div>
<div class="line"><span class="stringliteral">                pesel           =&gt; text;     PESEL number;                                         length(0 11),char(digit);</span></div>
<div class="line"><span class="stringliteral">                address         =&gt; textarea; address &lt;small&gt;(for the insurance)&lt;/small&gt;;           ;</span></div>
<div class="line"><span class="stringliteral">                telephone       =&gt; text;     telephone;                                            longer(6);</span></div>
<div class="line"><span class="stringliteral">                parenttelephone =&gt; text;     telephone to your parents/carers;                     ;</span></div>
<div class="line"><span class="stringliteral">                staybegintime   =&gt; select;   staying time: &lt;span class=&quot;right&quot;&gt;from&lt;/span&gt;;        int;</span></div>
<div class="line"><span class="stringliteral">                stayendtime     =&gt; select;                 &lt;span class=&quot;right&quot;&gt;to&lt;/span&gt;;          int;</span></div>
<div class="line"><span class="stringliteral">                gatherplace     =&gt; select;   I\&#39;ll join the gathering at;                          ;     default=&gt;none;</span></div>
<div class="line"><span class="stringliteral">                isselfcatered   =&gt; checkbox; accomodation and meals;                               ;</span></div>
<div class="line"><span class="stringliteral">                tshirtsize      =&gt; select;   preferred t-shirt size;                               ;     default=&gt;L;</span></div>
<div class="line"><span class="stringliteral">                comments        =&gt; textarea; comments (e.g. vegetarian);                           ;</span></div>
<div class="line"><span class="stringliteral">        &#39;</span>);</div>
<div class="line">        <span class="keywordflow">if</span> (<a class="code" href="user_2utils_8php.html#ae6297fbd3e8fa7cc5feb6411a80deee9">userIs</a>(<span class="stringliteral">&#39;lecturer&#39;</span>))</div>
<div class="line">                unset($inputs[<span class="stringliteral">&#39;parenttelephone&#39;</span>]);</div>
<div class="line"></div>
<div class="line">        $data = $DB-&gt;editions[$edition]-&gt;assoc(<span class="charliteral">&#39;*&#39;</span>);</div>
<div class="line">        $starttime = $data[<span class="stringliteral">&#39;begintime&#39;</span>];</div>
<div class="line">        $starttime -= 60*60*strftime(<span class="stringliteral">&#39;%H&#39;</span>, $starttime);</div>
<div class="line">        $hours = explode(<span class="charliteral">&#39; &#39;</span>, $data[<span class="stringliteral">&#39;importanthours&#39;</span>]);</div>
<div class="line">        $stayoptions = array();</div>
<div class="line">        $inputs[<span class="stringliteral">&#39;staybegintime&#39;</span>][<span class="stringliteral">&#39;default&#39;</span>] = <span class="keyword">false</span>;</div>
<div class="line">        <span class="keywordflow">for</span> ($day=0; $starttime + $day*24*60*60 &lt;= $data[<span class="stringliteral">&#39;endtime&#39;</span>]; $day++)</div>
<div class="line">                <span class="keywordflow">foreach</span> ($hours as $h)</div>
<div class="line">        {</div>
<div class="line">                $time = $starttime+($day*24+$h)*60*60;</div>
<div class="line">                <span class="keywordflow">if</span> ($time &gt;= $data[<span class="stringliteral">&#39;begintime&#39;</span>] &amp;&amp; $time &lt;= $data[<span class="stringliteral">&#39;endtime&#39;</span>])</div>
<div class="line">                        $stayoptions[$time] = strftime(<span class="stringliteral">&#39;%e. (%a) %H:%M&#39;</span>, $time);</div>
<div class="line">                <span class="keywordflow">if</span> (!$inputs[<span class="stringliteral">&#39;staybegintime&#39;</span>][<span class="stringliteral">&#39;default&#39;</span>])</div>
<div class="line">                        $inputs[<span class="stringliteral">&#39;staybegintime&#39;</span>][<span class="stringliteral">&#39;default&#39;</span>] = $time;</div>
<div class="line">                $inputs[<span class="stringliteral">&#39;stayendtime&#39;</span>][<span class="stringliteral">&#39;default&#39;</span>] = $time;</div>
<div class="line">        }</div>
<div class="line">        $inputs[<span class="stringliteral">&#39;staybegintime&#39;</span>][<span class="stringliteral">&#39;options&#39;</span>] = $stayoptions;</div>
<div class="line">        $inputs[<span class="stringliteral">&#39;stayendtime&#39;</span>][<span class="stringliteral">&#39;options&#39;</span>]   = $stayoptions;</div>
<div class="line"></div>
<div class="line">        $inputs[<span class="stringliteral">&#39;gatherplace&#39;</span>][<span class="stringliteral">&#39;options&#39;</span>] = array(<span class="stringliteral">&#39;warszawa&#39;</span>=&gt;_(<span class="stringliteral">&#39;Warsaw PKP&#39;</span>),<span class="stringliteral">&#39;olsztyn&#39;</span>=&gt;_(<span class="stringliteral">&#39;Olsztyn PKP&#39;</span>),<span class="stringliteral">&#39;wegorzewo&#39;</span>=&gt;_(<span class="stringliteral">&#39;Węgorzewo - hostel&#39;</span>),<span class="stringliteral">&#39;none&#39;</span>=&gt;_(<span class="stringliteral">&#39;I\&#39;ll arrive on my own.&#39;</span>));</div>
<div class="line">        $tshirtsizes = array(<span class="stringliteral">&#39;XS&#39;</span>,<span class="charliteral">&#39;S&#39;</span>,<span class="charliteral">&#39;M&#39;</span>,<span class="charliteral">&#39;L&#39;</span>,<span class="stringliteral">&#39;XL&#39;</span>,<span class="stringliteral">&#39;XXL&#39;</span>);</div>
<div class="line">        $inputs[<span class="stringliteral">&#39;tshirtsize&#39;</span>][<span class="stringliteral">&#39;options&#39;</span>] = array_combine($tshirtsizes, $tshirtsizes);;</div>
<div class="line">        $inputs[<span class="stringliteral">&#39;isselfcatered&#39;</span>][<span class="stringliteral">&#39;text&#39;</span>] = _(<span class="stringliteral">&#39;on my own&#39;</span>) .</div>
<div class="line">                <span class="stringliteral">&#39;&lt;small &#39;</span>. <a class="code" href="template_8php.html#a9b9585537fe5238d4d5b54478251ccfa">getTipJS</a>(_(<span class="stringliteral">&#39;applies to Węgorzewo residents, for example&#39;</span>)) .<span class="stringliteral">&#39;&gt;[?]&lt;/small&gt;&#39;</span>;</div>
<div class="line"></div>
<div class="line"></div>
<div class="line">        $form = <span class="keyword">new</span> <a class="code" href="classForm.html">Form</a>($inputs);</div>
<div class="line"></div>
<div class="line">        $editionColumns = array(<span class="stringliteral">&#39;staybegintime&#39;</span>,<span class="stringliteral">&#39;stayendtime&#39;</span>,<span class="stringliteral">&#39;isselfcatered&#39;</span>);</div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">if</span> ($form-&gt;submitted() &amp;&amp; !$admin)</div>
<div class="line">        {</div>
<div class="line">                $values = $form-&gt;fetchAndValidateValues();</div>
<div class="line">                <span class="keywordflow">if</span> ($form-&gt;valid)</div>
<div class="line">                {</div>
<div class="line">                        $editionValues = array();</div>
<div class="line">                        <span class="keywordflow">foreach</span> ($editionColumns as $column)</div>
<div class="line">                        {</div>
<div class="line">                                $editionValues[$column] = $values[$column];</div>
<div class="line">                                unset($values[$column]);</div>
<div class="line">                        }</div>
<div class="line">                        $editionValues[<span class="stringliteral">&#39;lastmodification&#39;</span>] = time();</div>
<div class="line">                        $DB-&gt;users[$uid]-&gt;update($values);</div>
<div class="line">                        $DB-&gt;edition_users($edition, $uid)-&gt;update($editionValues);</div>
<div class="line">                        $PAGE-&gt;addMessage(_(<span class="stringliteral">&#39;Saved.&#39;</span>), <span class="stringliteral">&#39;success&#39;</span>);</div>
<div class="line">                        <a class="code" href="log_8php.html#a5eaecfade7f5e117c98d7635b2aba95f">logUser</a>(<span class="stringliteral">&#39;user edit2&#39;</span>, $uid);</div>
<div class="line">                }</div>
<div class="line">        }</div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">if</span> (is_null($r[<span class="stringliteral">&#39;tshirtsize&#39;</span>]))  $r[<span class="stringliteral">&#39;tshirtsize&#39;</span>] = <span class="charliteral">&#39;L&#39;</span>;</div>
<div class="line">        $r += $DB-&gt;edition_users($edition,$uid)-&gt;assoc(implode(<span class="charliteral">&#39;,&#39;</span>,$editionColumns));</div>
<div class="line"></div>
<div class="line">        $stayoptions = array_keys($stayoptions);</div>
<div class="line">        <span class="keywordflow">if</span> (!in_array($r[<span class="stringliteral">&#39;staybegintime&#39;</span>], $stayoptions))</div>
<div class="line">                $r[<span class="stringliteral">&#39;staybegintime&#39;</span>] = $stayoptions[0];</div>
<div class="line">        <span class="keywordflow">if</span> (!in_array($r[<span class="stringliteral">&#39;stayendtime&#39;</span>], $stayoptions))</div>
<div class="line">                $r[<span class="stringliteral">&#39;stayendtime&#39;</span>] = $stayoptions[count($stayoptions) - 1];</div>
<div class="line"></div>
<div class="line">        $form-&gt;values = $r;</div>
<div class="line">        $form-&gt;columnWidth = <span class="stringliteral">&#39;25%&#39;</span>;</div>
<div class="line">        <span class="keywordflow">if</span> ($admin)</div>
<div class="line">                $form-&gt;submitValue = null;</div>
<div class="line">        <span class="keywordflow">return</span> print $form-&gt;getHTML();</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="ad603b73d651c86d7ae2bf48c936712cc"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">actionEditMotivationLetter </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="profile_8php_source.html#l00395">395</a> of file <a class="el" href="profile_8php_source.html">profile.php</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        <span class="keywordflow">if</span> (!<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;editMotivationLetter&#39;</span>))  <span class="keywordflow">throw</span> <span class="keyword">new</span> <a class="code" href="classPolicyException.html">PolicyException</a>();</div>
<div class="line">        global $USER, <a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>, <a class="code" href="common_8php.html#a7dc56dc8b18ad37272b56fa7395bedef">$DB</a>;</div>
<div class="line">        $PAGE-&gt;title = _(<span class="stringliteral">&#39;Motivation letter&#39;</span>);</div>
<div class="line">        <span class="keywordflow">if</span> (!<a class="code" href="user_2utils_8php.html#a5bbc4a39c360e15b0c00714f18d2082b">assertProfileFilled</a>())  <span class="keywordflow">return</span>;</div>
<div class="line"></div>
<div class="line">        $inputs = <a class="code" href="utils_8php.html#ae70693a7d9a8484219fe57bdf2d2a46f">parseTable</a>(<span class="stringliteral">&#39;</span></div>
<div class="line"><span class="stringliteral">                NAME               =&gt; TYPE;</span></div>
<div class="line"><span class="stringliteral">                motivationletter   =&gt; richtextarea;</span></div>
<div class="line"><span class="stringliteral">        &#39;</span>);</div>
<div class="line">        $inputs[<span class="stringliteral">&#39;motivationletter&#39;</span>][<span class="stringliteral">&#39;description&#39;</span>] = sprintf(<a class="code" href="user_2utils_8php.html#a7144fa5a413ad5690425b7b720aeedba">genderize</a>(_(</div>
<div class="line">                         <span class="stringliteral">&#39;Write (in %d - %d words) referring to each point in a separate paragraph:&lt;br/&gt;&#39;</span></div>
<div class="line">                        .<span class="stringliteral">&#39;1. Describe your main scientific interests. A detailed description would be welcome (if you’re interested in mathematics - which area are you most interested in; if it’s programming - what programs are you making and in what language, etc.).&lt;br/&gt;&#39;</span></div>
<div class="line">                        .<span class="stringliteral">&#39;2. How do you develop your interests from section 1.? Write down what books you read, what type of tasks and problems you solve, etc. If you have your own projects, works, experiments, programs - describe them. If you’re a member of Polish Children’s Fund, briefly describe what you do in the program.&lt;br/&gt;&#39;</span></div>
<div class="line">                        .<span class="stringliteral">&#39;3. If you’re interested in something not strictly scientific (that is, besides math/physics/computer science) or you are involved in other initiatives, describe them briefly.&lt;br/&gt;&#39;</span></div>
<div class="line">                        .<span class="stringliteral">&#39;4. If you participate in competitions or olympic contests, describe your achievements (participation, awards).&lt;br/&gt;&#39;</span></div>
<div class="line">                        .<span class="stringliteral">&#39;5. About which of your interests would you tell others most preferably?&lt;br/&gt;&#39;</span></div>
<div class="line">                        .<span class="stringliteral">&#39;6. What do you expect from your participation in WWW, what encouraged you to apply? If you want to contribute somehow (organise something, give an evening lecture, etc.), describe it.&lt;br/&gt;&#39;</span></div>
<div class="line">                        .<span class="stringliteral">&#39;7. Are you willing to give a 15-minute speech at WWW (which would be appreciated)? If so, describe its title and topic. If you are not sure about what you want to say, please contact us.&lt;br/&gt;&#39;</span></div>
<div class="line">                        .<span class="stringliteral">&#39;8. Here you can write anything which didn’t fit in sections 1.-7. &lt;br/&gt;&#39;</span>)),</div>
<div class="line">                <a class="code" href="utils_8php.html#a86acce3c002ca1af709fd1b04f2f82fa">getOption</a>(<span class="stringliteral">&#39;motivationLetterWords&#39;</span>), 1000); <span class="comment">//TODO maybe set it as option?</span></div>
<div class="line">        $form = <span class="keyword">new</span> <a class="code" href="classForm.html">Form</a>($inputs);</div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">if</span> ($form-&gt;submitted())</div>
<div class="line">        {</div>
<div class="line">                $values = $form-&gt;fetchAndValidateValues();</div>
<div class="line">                <span class="keywordflow">if</span> ($form-&gt;valid)</div>
<div class="line">                {</div>
<div class="line">                        $DB-&gt;users[$USER[<span class="stringliteral">&#39;uid&#39;</span>]]-&gt;update($values);</div>
<div class="line">                        $PAGE-&gt;addMessage(_(<span class="stringliteral">&#39;Your motivation letter has been saved.&#39;</span>), <span class="stringliteral">&#39;success&#39;</span>);</div>
<div class="line">                        <a class="code" href="log_8php.html#a5eaecfade7f5e117c98d7635b2aba95f">logUser</a>(<span class="stringliteral">&#39;user edit3&#39;</span>);</div>
<div class="line">                }</div>
<div class="line">        }</div>
<div class="line"></div>
<div class="line">        $form-&gt;values = $DB-&gt;users[$USER[<span class="stringliteral">&#39;uid&#39;</span>]]-&gt;assoc($form-&gt;getColumns());</div>
<div class="line">        <span class="keywordflow">return</span> print $form-&gt;getHTML();</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a0e394e32f8c12de6f267b12957a3c219"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">actionEditProfile </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$uid</em> = <code>null</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="profile_8php_source.html#l00084">84</a> of file <a class="el" href="profile_8php_source.html">profile.php</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global $USER, <a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>, <a class="code" href="common_8php.html#a7dc56dc8b18ad37272b56fa7395bedef">$DB</a>;</div>
<div class="line">        $currentEdition = <a class="code" href="utils_8php.html#a86acce3c002ca1af709fd1b04f2f82fa">getOption</a>(<span class="stringliteral">&#39;currentEdition&#39;</span>);</div>
<div class="line">        <span class="comment">// Edit my own profile or admin-edit someone other&#39;s profile:</span></div>
<div class="line">        $admin = !is_null($uid);</div>
<div class="line">        <span class="keywordflow">if</span> ($admin)</div>
<div class="line">        {</div>
<div class="line">                <span class="keywordflow">if</span> (!<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;adminUsers&#39;</span>))  <span class="keywordflow">throw</span> <span class="keyword">new</span> <a class="code" href="classPolicyException.html">PolicyException</a>();</div>
<div class="line">                $uid = intval($uid);</div>
<div class="line">                <span class="keywordflow">if</span> (!isset($DB-&gt;users[$uid]))</div>
<div class="line">                        <span class="keywordflow">throw</span> <span class="keyword">new</span> <a class="code" href="classKnownException.html">KnownException</a>(_(<span class="stringliteral">&#39;User not found.&#39;</span>));</div>
<div class="line">                $name = $DB-&gt;users[$uid]-&gt;get(<span class="stringliteral">&#39;name&#39;</span>);</div>
<div class="line">                $PAGE-&gt;title = $name. <span class="stringliteral">&#39; - &#39;</span>. _(<span class="stringliteral">&#39;profile&#39;</span>);</div>
<div class="line">                $PAGE-&gt;headerTitle = <a class="code" href="admin_8php.html#a9cfe349e8c7f62fd2a38c48f80b90028">getUserHeader</a>($uid, $name, <span class="stringliteral">&#39;editProfile&#39;</span>);</div>
<div class="line">        }</div>
<div class="line">        <span class="keywordflow">else</span></div>
<div class="line">        {</div>
<div class="line">                $uid = intval($USER[<span class="stringliteral">&#39;uid&#39;</span>]);</div>
<div class="line">                <span class="comment">//if (!userCan(&#39;editProfile&#39;, $uid))  throw new PolicyException();</span></div>
<div class="line">                $admin = <span class="keyword">false</span>;</div>
<div class="line">                $PAGE-&gt;title = _(<span class="stringliteral">&#39;Your profile&#39;</span>);</div>
<div class="line">        }</div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">if</span> (<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;impersonate&#39;</span>, $uid) &amp;&amp; ($uid != $USER[<span class="stringliteral">&#39;uid&#39;</span>]))</div>
<div class="line">                echo <span class="stringliteral">&#39;&lt;a href=&quot;impersonate(&#39;</span>. $uid .<span class="stringliteral">&#39;)/&quot; &#39;</span>.</div>
<div class="line">                        <a class="code" href="template_8php.html#a9b9585537fe5238d4d5b54478251ccfa">getTipJS</a>(_(<span class="stringliteral">&#39;Executes everything as if you were logged in as that person.&#39;</span>)) .<span class="charliteral">&#39;&gt;&#39;</span>.</div>
<div class="line">                        _(<span class="stringliteral">&#39;impersonate&#39;</span>). <span class="stringliteral">&#39;&lt;/a&gt;&#39;</span>;</div>
<div class="line"></div>
<div class="line">        $nadmin = $admin ? <span class="stringliteral">&#39;false&#39;</span> : <span class="stringliteral">&#39;true&#39;</span>; <span class="comment">// Non-admins can only read some values.</span></div>
<div class="line">        $inputs = <a class="code" href="utils_8php.html#ae70693a7d9a8484219fe57bdf2d2a46f">parseTable</a>(<span class="stringliteral">&quot;</span></div>
<div class="line"><span class="stringliteral">                NAME            =&gt; TYPE;          tDESCRIPTION;            bREADONLY; VALIDATION;</span></div>
<div class="line"><span class="stringliteral">                registered      =&gt; timestamp;     registered;              true;      ;</span></div>
<div class="line"><span class="stringliteral">                logged          =&gt; timestamp;     last login;              true;      ;</span></div>
<div class="line"><span class="stringliteral">                avatar          =&gt; custom;        photo;                   true;      ;</span></div>
<div class="line"><span class="stringliteral">                name            =&gt; text;          full name;               $nadmin;   charset(name),length(3 70);</span></div>
<div class="line"><span class="stringliteral">                login           =&gt; text;          username;                $nadmin;   charset(name digit),length(3 20);</span></div>
<div class="line"><span class="stringliteral">                email           =&gt; text;          e-mail;                  $nadmin;   email;</span></div>
<div class="line"><span class="stringliteral">                password        =&gt; custom;        password;                true;      ;</span></div>
<div class="line"><span class="stringliteral">                gender          =&gt; select;        grammatical gender;      false;     ;</span></div>
<div class="line"><span class="stringliteral">                role            =&gt; select;        role in current edition; $nadmin;   ;              notdb;</span></div>
<div class="line"><span class="stringliteral">                roles           =&gt; checkboxgroup; other roles;             $nadmin;   ;              notdb;</span></div>
<div class="line"><span class="stringliteral">                school          =&gt; text;          school/university;       false;     ;</span></div>
<div class="line"><span class="stringliteral">                graduationyear  =&gt; select;        high school graduation year; false; int;           other=&gt;;</span></div>
<div class="line"><span class="stringliteral">                howdoyouknowus  =&gt; text;          how do you know us?;     false;     ;</span></div>
<div class="line"><span class="stringliteral">                interests       =&gt; richtextarea;  interests;               false;     ;</span></div>
<div class="line"><span class="stringliteral">        &quot;</span>);</div>
<div class="line"></div>
<div class="line">        $inputs[<span class="stringliteral">&#39;avatar&#39;</span>][<span class="stringliteral">&#39;default&#39;</span>] = <span class="stringliteral">&#39;&lt;div onclick=\&#39;$(&quot;#avatarSign&quot;).toggle(); $(&quot;#avatarBox&quot;).toggle(&quot;fast&quot;);\&#39; style=&quot;cursor: pointer&quot;&gt;</span></div>
<div class="line"><span class="stringliteral">                         &lt;span id=&quot;avatarSign&quot;&gt;+&lt;/span&gt; &#39;</span>. _(<span class="stringliteral">&#39;change&#39;</span>) .<span class="stringliteral">&#39;...&lt;/div&gt;&lt;div id=&quot;avatarBox&quot;&gt;&#39;</span>.</div>
<div class="line">                         <span class="stringliteral">&#39;&lt;div id=&quot;avatarUpload&quot;&gt;&lt;/div&gt; &lt;img id=&quot;avatar&quot; &#39;</span>;</div>
<div class="line">        $src = <a class="code" href="profile_8php.html#a0c599d4d650d9e6be9ff83f387f2a54a">getAvatarPath</a>($uid);</div>
<div class="line">        <span class="keywordflow">if</span> (file_exists($src))</div>
<div class="line">                $inputs[<span class="stringliteral">&#39;avatar&#39;</span>][<span class="stringliteral">&#39;default&#39;</span>] .= <span class="stringliteral">&#39;src=&quot;&#39;</span>. $src .<span class="charliteral">&#39;?&#39;</span>. filemtime($src) .<span class="charliteral">&#39;&quot;&#39;</span>;</div>
<div class="line">        $inputs[<span class="stringliteral">&#39;avatar&#39;</span>][<span class="stringliteral">&#39;default&#39;</span>] .=</div>
<div class="line">                         <span class="stringliteral">&#39; /&gt; &lt;/div&gt;&#39;</span>;</div>
<div class="line">        $inputs[<span class="stringliteral">&#39;password&#39;</span>][<span class="stringliteral">&#39;default&#39;</span>] = <span class="stringliteral">&#39;&lt;a href=&quot;changePassword&quot;&gt;&#39;</span>. _(<span class="stringliteral">&#39;change&#39;</span>) .<span class="stringliteral">&#39;&lt;/a&gt;&#39;</span>;</div>
<div class="line"></div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">if</span> ($admin)</div>
<div class="line">                unset($inputs[<span class="stringliteral">&#39;password&#39;</span>]);</div>
<div class="line">        <span class="keywordflow">else</span></div>
<div class="line">        {</div>
<div class="line">                unset($inputs[<span class="stringliteral">&#39;registered&#39;</span>]);</div>
<div class="line">                unset($inputs[<span class="stringliteral">&#39;logged&#39;</span>]);</div>
<div class="line">        }</div>
<div class="line">        $inputs[<span class="stringliteral">&#39;gender&#39;</span>][<span class="stringliteral">&#39;options&#39;</span>] = array(<span class="charliteral">&#39;m&#39;</span> =&gt; _(<span class="stringliteral">&#39;masculine&#39;</span>), <span class="charliteral">&#39;f&#39;</span> =&gt; _(<span class="stringliteral">&#39;feminine&#39;</span>));</div>
<div class="line">        $inputs[<span class="stringliteral">&#39;role&#39;</span>][<span class="stringliteral">&#39;options&#39;</span>] = array(</div>
<div class="line">                <span class="stringliteral">&#39;none&#39;</span>=&gt; _(<span class="stringliteral">&#39;None&#39;</span>),</div>
<div class="line">                <span class="stringliteral">&#39;candidate&#39;</span>=&gt; _(<span class="stringliteral">&#39;Candidate&#39;</span>),</div>
<div class="line">                <span class="stringliteral">&#39;qualified_candidate&#39;</span>=&gt; _(<span class="stringliteral">&#39;Qualified candidate&#39;</span>),</div>
<div class="line">                <span class="stringliteral">&#39;lecturer&#39;</span>=&gt; _(<span class="stringliteral">&#39;Lecturer&#39;</span>),</div>
<div class="line">                <span class="stringliteral">&#39;qualified_lecturer&#39;</span>=&gt; _(<span class="stringliteral">&#39;Qualified lecturer&#39;</span>),</div>
<div class="line">        );</div>
<div class="line">        $inputs[<span class="stringliteral">&#39;roles&#39;</span>][<span class="stringliteral">&#39;options&#39;</span>] = array(</div>
<div class="line">                <span class="stringliteral">&#39;admin&#39;</span>=&gt; _(<span class="stringliteral">&#39;Admin&#39;</span>),</div>
<div class="line">                <span class="stringliteral">&#39;tutor&#39;</span>=&gt; _(<span class="stringliteral">&#39;Tutor&#39;</span>),</div>
<div class="line">        );</div>
<div class="line">        $inputs[<span class="stringliteral">&#39;school&#39;</span>][<span class="stringliteral">&#39;autocomplete&#39;</span>] = $DB-&gt;query(<span class="stringliteral">&#39;SELECT school FROM table_users WHERE school IS NOT NULL</span></div>
<div class="line"><span class="stringliteral">                GROUP BY school HAVING count(*)&gt;1 ORDER BY count(*) DESC LIMIT 150&#39;</span>)-&gt;fetch_column();</div>
<div class="line">        $inputs[<span class="stringliteral">&#39;graduationyear&#39;</span>][<span class="stringliteral">&#39;options&#39;</span>] = <a class="code" href="profile_8php.html#a6e25cefab90ef44a1ae9cbfb47ad4f22">getGraduationYearOptions</a>();</div>
<div class="line"></div>
<div class="line">        $form = <span class="keyword">new</span> <a class="code" href="classForm.html">Form</a>($inputs);</div>
<div class="line">        $form-&gt;columnWidth = <span class="stringliteral">&#39;35%&#39;</span>;</div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">if</span> ($form-&gt;submitted())</div>
<div class="line">        {</div>
<div class="line">                $values = $form-&gt;fetchAndValidateValues();</div>
<div class="line">                <span class="keywordflow">if</span> ($form-&gt;valid)</div>
<div class="line">                {</div>
<div class="line">                        <span class="comment">// Update roles (in table_user_roles and table_edition_users.{lecturer,qualified}.</span></div>
<div class="line">                        <span class="keywordflow">if</span> ($admin)</div>
<div class="line">                        {</div>
<div class="line">                                $role = $values[<span class="stringliteral">&#39;role&#39;</span>];</div>
<div class="line">                                unset($values[<span class="stringliteral">&#39;role&#39;</span>]);</div>
<div class="line">                                $roles = array();</div>
<div class="line">                                <span class="keywordflow">if</span> (isset($_POST[<span class="stringliteral">&#39;roles&#39;</span>]) &amp;&amp; is_array($_POST[<span class="stringliteral">&#39;roles&#39;</span>])) <span class="comment">//test for empty checkboxGroup</span></div>
<div class="line">                                        $roles = $_POST[<span class="stringliteral">&#39;roles&#39;</span>];</div>
<div class="line"></div>
<div class="line">                                <span class="keywordflow">if</span> ($role == <span class="stringliteral">&#39;none&#39;</span>)</div>
<div class="line">                                        $DB-&gt;edition_users($currentEdition, $uid)-&gt;delete();</div>
<div class="line">                                <span class="keywordflow">else</span></div>
<div class="line">                                {</div>
<div class="line">                                        $value = array(</div>
<div class="line">                                                <span class="stringliteral">&#39;qualified&#39;</span> =&gt; (strpos($role, <span class="stringliteral">&#39;qualified&#39;</span>) !== <span class="keyword">false</span>) ? 1 : 0,</div>
<div class="line">                                                <span class="stringliteral">&#39;lecturer&#39;</span> =&gt;  (strpos($role, <span class="stringliteral">&#39;lecturer&#39;</span>)  !== <span class="keyword">false</span>) ? 1 : 0,</div>
<div class="line">                                        );</div>
<div class="line"></div>
<div class="line">                                        <span class="keywordflow">if</span> ($DB-&gt;edition_users($currentEdition, $uid)-&gt;count())</div>
<div class="line">                                                $DB-&gt;edition_users($currentEdition, $uid)-&gt;update($value);</div>
<div class="line">                                        <span class="keywordflow">else</span></div>
<div class="line">                                        {</div>
<div class="line">                                                $value[<span class="stringliteral">&#39;edition&#39;</span>] = $currentEdition;</div>
<div class="line">                                                $value[<span class="stringliteral">&#39;uid&#39;</span>] = $uid;</div>
<div class="line">                                                $DB-&gt;edition_users[]= $value;</div>
<div class="line">                                        }</div>
<div class="line">                                }</div>
<div class="line"></div>
<div class="line">                                $DB-&gt;query(<span class="stringliteral">&#39;DELETE FROM table_user_roles WHERE uid=$1&#39;</span>, $uid);</div>
<div class="line">                                <span class="keywordflow">foreach</span> ($roles as $role)</div>
<div class="line">                                        $DB-&gt;user_roles[]= array(<span class="stringliteral">&#39;uid&#39;</span>=&gt;$uid,<span class="stringliteral">&#39;role&#39;</span>=&gt;$role);</div>
<div class="line">                        }</div>
<div class="line">                        <span class="comment">// ordername of &#39;Tom Marvolo Riddle&#39; is &#39;Riddle Tom Marvolo 666&#39;.</span></div>
<div class="line">                        <span class="keywordflow">if</span> (isset($values[<span class="stringliteral">&#39;name&#39;</span>]))</div>
<div class="line">                        {</div>
<div class="line">                                $nameParts = explode(<span class="charliteral">&#39; &#39;</span>, $values[<span class="stringliteral">&#39;name&#39;</span>]);</div>
<div class="line">                                array_unshift($nameParts, array_pop($nameParts));</div>
<div class="line">                                $nameParts[]= $uid;</div>
<div class="line">                                $values[<span class="stringliteral">&#39;ordername&#39;</span>] = implode(<span class="charliteral">&#39; &#39;</span>, $nameParts);</div>
<div class="line">                        }</div>
<div class="line"></div>
<div class="line">                        $DB-&gt;users[$uid]-&gt;update($values);</div>
<div class="line">                        $PAGE-&gt;addMessage(_(<span class="stringliteral">&#39;Saved.&#39;</span>), <span class="stringliteral">&#39;success&#39;</span>);</div>
<div class="line">                        <a class="code" href="log_8php.html#a5eaecfade7f5e117c98d7635b2aba95f">logUser</a>(<span class="stringliteral">&#39;user edit&#39;</span>, $uid);</div>
<div class="line">                }</div>
<div class="line">        }</div>
<div class="line"></div>
<div class="line">        $form-&gt;values = $DB-&gt;users[$uid]-&gt;assoc($form-&gt;getColumns() .<span class="stringliteral">&#39;,&quot;confirm&quot;&#39;</span>);</div>
<div class="line">        <span class="keywordflow">if</span> (isset($form[<span class="stringliteral">&#39;registered&#39;</span>]))</div>
<div class="line">                $form[<span class="stringliteral">&#39;registered&#39;</span>][<span class="stringliteral">&#39;description&#39;</span>] = <a class="code" href="user_2utils_8php.html#a7144fa5a413ad5690425b7b720aeedba">genderize</a>($form[<span class="stringliteral">&#39;registered&#39;</span>][<span class="stringliteral">&#39;description&#39;</span>], $form-&gt;values[<span class="stringliteral">&#39;gender&#39;</span>]);</div>
<div class="line">        $roles = $DB-&gt;query(<span class="stringliteral">&#39;SELECT role FROM table_user_roles WHERE uid=$1&#39;</span>, $uid);</div>
<div class="line">        $form-&gt;values[<span class="stringliteral">&#39;roles&#39;</span>] = array_intersect($roles-&gt;fetch_column(), array_keys($inputs[<span class="stringliteral">&#39;roles&#39;</span>][<span class="stringliteral">&#39;options&#39;</span>]));</div>
<div class="line">        $row = $DB-&gt;edition_users($currentEdition, $uid);</div>
<div class="line">        <span class="keywordflow">if</span> (!$row-&gt;count())</div>
<div class="line">                $form-&gt;values[<span class="stringliteral">&#39;role&#39;</span>] = <span class="stringliteral">&#39;none&#39;</span>;</div>
<div class="line">        <span class="keywordflow">else</span></div>
<div class="line">        {</div>
<div class="line">                $form-&gt;values[<span class="stringliteral">&#39;role&#39;</span>] =  $row-&gt;get(<span class="stringliteral">&#39;qualified&#39;</span>) ? <span class="stringliteral">&#39;qualified_&#39;</span> : <span class="stringliteral">&#39;&#39;</span>;</div>
<div class="line">                $form-&gt;values[<span class="stringliteral">&#39;role&#39;</span>] .= $row-&gt;get(<span class="stringliteral">&#39;lecturer&#39;</span>) ? <span class="stringliteral">&#39;lecturer&#39;</span> : <span class="stringliteral">&#39;candidate&#39;</span>;</div>
<div class="line">        }</div>
<div class="line">        <span class="keywordflow">if</span> ($admin)</div>
<div class="line">        {</div>
<div class="line">                <span class="keywordflow">if</span> ($form-&gt;values[<span class="stringliteral">&#39;confirm&#39;</span>] &gt; 0)</div>
<div class="line">                {</div>
<div class="line">                        $form-&gt;values[<span class="stringliteral">&#39;logged&#39;</span>] = _(<span class="stringliteral">&#39;the user hasn\&#39;t confirmed his e-mail yet&#39;</span>);</div>
<div class="line">                        $form[<span class="stringliteral">&#39;logged&#39;</span>][<span class="stringliteral">&#39;type&#39;</span>] = <span class="stringliteral">&#39;text&#39;</span>;</div>
<div class="line">                }</div>
<div class="line">                <span class="keywordflow">else</span> <span class="keywordflow">if</span> ($form-&gt;values[<span class="stringliteral">&#39;logged&#39;</span>] == 0)</div>
<div class="line">                {</div>
<div class="line">                        $form-&gt;values[<span class="stringliteral">&#39;logged&#39;</span>] = _(<span class="stringliteral">&#39;the user hasn\&#39;t logged in yet&#39;</span>);</div>
<div class="line">                        $form[<span class="stringliteral">&#39;logged&#39;</span>][<span class="stringliteral">&#39;type&#39;</span>] = <span class="stringliteral">&#39;text&#39;</span>;</div>
<div class="line">                }</div>
<div class="line">        }</div>
<div class="line"></div>
<div class="line">        <span class="comment">// Avatar uploader.</span></div>
<div class="line">        $uploader = array(</div>
<div class="line">                <span class="stringliteral">&#39;request&#39;</span> =&gt; array(</div>
<div class="line">                        <span class="stringliteral">&#39;endpoint&#39;</span> =&gt; <span class="stringliteral">&#39;fineuploader/handle.php&#39;</span>,</div>
<div class="line">                        <span class="stringliteral">&#39;params&#39;</span> =&gt; array(<span class="stringliteral">&#39;uid&#39;</span> =&gt; $uid)</div>
<div class="line">                ),</div>
<div class="line">                <span class="stringliteral">&#39;validation&#39;</span> =&gt; array(</div>
<div class="line">                        <span class="stringliteral">&#39;allowedExtensions&#39;</span> =&gt; array(<span class="stringliteral">&#39;jpeg&#39;</span>, <span class="stringliteral">&#39;jpg&#39;</span>),</div>
<div class="line">                        <span class="stringliteral">&#39;sizeLimit&#39;</span> =&gt; 5 * 1024 * 1024, <span class="comment">// 5M</span></div>
<div class="line">                ),</div>
<div class="line">                <span class="stringliteral">&#39;debug&#39;</span> =&gt; <span class="keyword">true</span>, <span class="comment">// log messages in browser console</span></div>
<div class="line">                <span class="stringliteral">&#39;multiple&#39;</span> =&gt; <span class="keyword">false</span>,</div>
<div class="line">                <span class="stringliteral">&#39;text&#39;</span> =&gt; array(<span class="stringliteral">&#39;uploadButton&#39;</span> =&gt; _(<span class="stringliteral">&#39;Upload&#39;</span>))</div>
<div class="line">        );</div>
<div class="line">        $PAGE-&gt;jsOnLoad .= <span class="stringliteral">&#39;var avatarUploader = $(&quot;#avatarUpload&quot;).fineUploader(&#39;</span>.</div>
<div class="line">                json_encode($uploader) .<span class="charliteral">&#39;)&#39;</span>.</div>
<div class="line">                <span class="stringliteral">&#39;.on(&quot;complete&quot;, function(event, id, fileName, responseJSON) {</span></div>
<div class="line"><span class="stringliteral">                        if (responseJSON.success) {</span></div>
<div class="line"><span class="stringliteral">                                $(&quot;#avatar&quot;).attr(&quot;src&quot;,</span></div>
<div class="line"><span class="stringliteral">                                        &quot;&#39;</span>. <a class="code" href="profile_8php.html#a0c599d4d650d9e6be9ff83f387f2a54a">getAvatarPath</a>($uid) .<span class="stringliteral">&#39;?&quot;+ new Date().getTime());</span></div>
<div class="line"><span class="stringliteral">                                setTimeout(function(){ $(&quot;#avatarUpload&quot;).fineUploader(&quot;reset&quot;); }, 3000);</span></div>
<div class="line"><span class="stringliteral">                        } });</span></div>
<div class="line"><span class="stringliteral">        &#39;</span>;</div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">return</span> print $form-&gt;getHTML();</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a91891599d32d0aa284d8690d6f0e090e"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">actionHandleAvatarUpload </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="profile_8php_source.html#l00275">275</a> of file <a class="el" href="profile_8php_source.html">profile.php</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        exit;</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="aff9daec7313da1b26885ec722adb53e2"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">actionShowProfile </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$uid</em> = <code>null</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="profile_8php_source.html#l00015">15</a> of file <a class="el" href="profile_8php_source.html">profile.php</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global $USER, <a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>, <a class="code" href="common_8php.html#a7dc56dc8b18ad37272b56fa7395bedef">$DB</a>;</div>
<div class="line">        $currentEdition = <a class="code" href="utils_8php.html#a86acce3c002ca1af709fd1b04f2f82fa">getOption</a>(<span class="stringliteral">&#39;currentEdition&#39;</span>);</div>
<div class="line">        $own = is_null($uid) || ($uid == $USER[<span class="stringliteral">&#39;uid&#39;</span>]);</div>
<div class="line">        $uid = $own ? $USER[<span class="stringliteral">&#39;uid&#39;</span>] : intval($uid);</div>
<div class="line">        <span class="keywordflow">if</span> (!<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;showProfile&#39;</span>, $uid))  <span class="keywordflow">throw</span> <span class="keyword">new</span> <a class="code" href="classPolicyException.html">PolicyException</a>();</div>
<div class="line">        <span class="keywordflow">if</span> (!isset($DB-&gt;users[$uid]))</div>
<div class="line">                <span class="keywordflow">throw</span> <span class="keyword">new</span> <a class="code" href="classKnownException.html">KnownException</a>(_(<span class="stringliteral">&#39;User not found.&#39;</span>));</div>
<div class="line"></div>
<div class="line">        $user = $DB-&gt;users[$uid]-&gt;assoc(<span class="charliteral">&#39;*&#39;</span>);</div>
<div class="line"></div>
<div class="line">        $gender = $user[<span class="stringliteral">&#39;gender&#39;</span>];</div>
<div class="line">        $PAGE-&gt;title = $user[<span class="stringliteral">&#39;name&#39;</span>]. <span class="stringliteral">&#39; - &#39;</span>. _(<span class="stringliteral">&#39;profile&#39;</span>);</div>
<div class="line">        $PAGE-&gt;headerTitle = <span class="stringliteral">&#39;&lt;span class=&quot;left&quot;&gt;&#39;</span>. $uid .<span class="stringliteral">&#39;.&amp;nbsp;&lt;/span&gt;&#39;</span>;</div>
<div class="line">        $PAGE-&gt;headerTitle .= <span class="stringliteral">&#39;&lt;h2&gt;&#39;</span>. $user[<span class="stringliteral">&#39;name&#39;</span>]. <span class="stringliteral">&#39; - &#39;</span>. _(<span class="stringliteral">&#39;profile&#39;</span>) .<span class="stringliteral">&#39;&lt;/h2&gt;&#39;</span>;</div>
<div class="line"></div>
<div class="line">        $avatar = <a class="code" href="profile_8php.html#a0c599d4d650d9e6be9ff83f387f2a54a">getAvatarPath</a>($uid);</div>
<div class="line">        <span class="keywordflow">if</span> (file_exists($avatar))</div>
<div class="line">                $user[<span class="stringliteral">&#39;avatar&#39;</span>] = <span class="stringliteral">&#39;&lt;img class=&quot;avatar&quot; src=&quot;&#39;</span>. $avatar .<span class="charliteral">&#39;?&#39;</span>. filemtime($avatar) .<span class="stringliteral">&#39;&quot; /&gt;&#39;</span>;</div>
<div class="line">        <span class="keywordflow">else</span></div>
<div class="line">                $user[<span class="stringliteral">&#39;avatar&#39;</span>] = <span class="stringliteral">&#39;&#39;</span>;</div>
<div class="line"></div>
<div class="line">        <span class="comment">//print &#39;&lt;a href=&quot;mailto:&#39;. $user[&#39;name&#39;] .&#39; &lt;&#39;. $user[&#39;email&#39;] .&#39;&gt;&quot;&gt;&#39;. $user[&#39;email&#39;] .&#39;&lt;/a&gt;&lt;br/&gt;&#39;;</span></div>
<div class="line"></div>
<div class="line">        $gradOptions = <a class="code" href="profile_8php.html#a6e25cefab90ef44a1ae9cbfb47ad4f22">getGraduationYearOptions</a>(<span class="keyword">true</span>);</div>
<div class="line">        <span class="keywordflow">if</span> (isset($gradOptions[$graduation]))</div>
<div class="line">                $user[<span class="stringliteral">&#39;graduationyear&#39;</span>] = $gradOptions[$user[<span class="stringliteral">&#39;graduationyear&#39;</span>]];</div>
<div class="line"></div>
<div class="line">        $user[<span class="stringliteral">&#39;interests&#39;</span>] = <a class="code" href="template_8php.html#a4a7e99592a2690b33d53c9bcc8fd3008">parseUserHTML</a>($user[<span class="stringliteral">&#39;interests&#39;</span>]);</div>
<div class="line">        $user[<span class="stringliteral">&#39;motivationletter&#39;</span>] = <a class="code" href="template_8php.html#a4a7e99592a2690b33d53c9bcc8fd3008">parseUserHTML</a>($user[<span class="stringliteral">&#39;motivationletter&#39;</span>]);</div>
<div class="line">        $user[<span class="stringliteral">&#39;badge&#39;</span>] = <a class="code" href="user_2utils_8php.html#a29f037f468ee2716970ae6e7293644e2">getUserBadge</a>($uid, <span class="keyword">true</span>);</div>
<div class="line">        $user[<span class="stringliteral">&#39;school&#39;</span>] = <a class="code" href="template_8php.html#a4a7e99592a2690b33d53c9bcc8fd3008">parseUserHTML</a>($user[<span class="stringliteral">&#39;school&#39;</span>]);</div>
<div class="line"></div>
<div class="line">        $template = <span class="keyword">new</span> <a class="code" href="classSimpleTemplate.html">SimpleTemplate</a>($user);</div>
<div class="line">        ?&gt;</div>
<div class="line">                &lt;span <span class="keyword">class</span>=<span class="stringliteral">&quot;left&quot;</span>&gt;%badge% (%login%)&lt;/span&gt;</div>
<div class="line">                &lt;span <span class="keyword">class</span>=<span class="stringliteral">&quot;right&quot;</span>&gt;%school% - ({{graduation year}}: %graduationyear%)&lt;/span&gt;&lt;br/&gt;</div>
<div class="line">                %avatar%</div>
<div class="line"></div>
<div class="line">                &lt;h3 onclick=<span class="stringliteral">&#39;$(&quot;#interests_sign&quot;).toggle(); $(&quot;#interests&quot;).toggle(&quot;fast&quot;);&#39;</span> style=<span class="stringliteral">&#39;cursor: pointer&#39;</span>&gt;</div>
<div class="line">                         &lt;span <span class="keywordtype">id</span>=<span class="stringliteral">&#39;interests_sign&#39;</span>&gt;+&lt;/span&gt; {{Interests}}&lt;/h3&gt;</div>
<div class="line">                &lt;div <span class="keyword">class</span>=<span class="stringliteral">&quot;descriptionBox&quot;</span> <span class="keywordtype">id</span>=<span class="stringliteral">&quot;interests&quot;</span> style=<span class="stringliteral">&quot;display:none&quot;</span>&gt;%interests%&lt;/div&gt;</div>
<div class="line">        &lt;?php</div>
<div class="line">        <span class="keywordflow">if</span> (<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;adminUsers&#39;</span>))</div>
<div class="line">        {</div>
<div class="line">        ?&gt;</div>
<div class="line">                &lt;h3 onclick=<span class="stringliteral">&#39;$(&quot;#motivation_sign&quot;).toggle(); $(&quot;#motivation&quot;).toggle(&quot;fast&quot;);&#39;</span> style=<span class="stringliteral">&#39;cursor: pointer&#39;</span>&gt;</div>
<div class="line">                        &lt;span <span class="keywordtype">id</span>=<span class="stringliteral">&#39;motivation_sign&#39;</span>&gt;+&lt;/span&gt; {{Motivation letter}}&lt;/h3&gt;</div>
<div class="line">                &lt;div <span class="keyword">class</span>=<span class="stringliteral">&quot;descriptionBox&quot;</span> <span class="keywordtype">id</span>=<span class="stringliteral">&quot;motivation&quot;</span> style=<span class="stringliteral">&quot;display:none&quot;</span>&gt;%motivationletter%&lt;/div&gt;</div>
<div class="line">        &lt;?php</div>
<div class="line">                <span class="comment">// TODO show roles, howdoyouknowus</span></div>
<div class="line">                print <span class="stringliteral">&#39;&lt;br/&gt;&#39;</span>;</div>
<div class="line">                print <a class="code" href="user_2utils_8php.html#a7144fa5a413ad5690425b7b720aeedba">genderize</a>(_(<span class="stringliteral">&#39;registered&#39;</span>), $gender) .<span class="stringliteral">&#39;: &#39;</span>;</div>
<div class="line">                print <a class="code" href="utils_8php.html#a16f4dfa58e8647af2e848df3623b628c">fixedStrftime</a>(<span class="stringliteral">&#39;%Y-%m-%d %H:%M (%ago%)&#39;</span>, $user[<span class="stringliteral">&#39;registered&#39;</span>]) ;</div>
<div class="line">                print <span class="stringliteral">&#39;, &amp;nbsp;&#39;</span>;</div>
<div class="line">                print _(<span class="stringliteral">&#39;last login&#39;</span>) .<span class="stringliteral">&#39;: &#39;</span>;</div>
<div class="line">                <span class="keywordflow">if</span> ($user[<span class="stringliteral">&#39;confirm&#39;</span>] &gt; 0)</div>
<div class="line">                        print _(<span class="stringliteral">&#39;the user hasn\&#39;t confirmed his e-mail yet&#39;</span>);</div>
<div class="line">                <span class="keywordflow">else</span> <span class="keywordflow">if</span> ($user[<span class="stringliteral">&#39;logged&#39;</span>] == 0)</div>
<div class="line">                        print _(<span class="stringliteral">&#39;the user hasn\&#39;t logged in yet&#39;</span>);</div>
<div class="line">                <span class="keywordflow">else</span></div>
<div class="line">                        print <a class="code" href="utils_8php.html#a16f4dfa58e8647af2e848df3623b628c">fixedStrftime</a>(<span class="stringliteral">&#39;%Y-%m-%d %H:%M (%ago%)&#39;</span>, $user[<span class="stringliteral">&#39;logged&#39;</span>]);</div>
<div class="line">                print <span class="stringliteral">&#39;&lt;br/&gt;&#39;</span>;</div>
<div class="line">        }</div>
<div class="line"></div>
<div class="line">        echo $template-&gt;finish(<span class="keyword">true</span>);</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a0c599d4d650d9e6be9ff83f387f2a54a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">getAvatarPath </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$uid</em> = <code>null</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="profile_8php_source.html#l00006">6</a> of file <a class="el" href="profile_8php_source.html">profile.php</a>.</p>

<p>Referenced by <a class="el" href="profile_8php_source.html#l00084">actionEditProfile()</a>, and <a class="el" href="profile_8php_source.html#l00015">actionShowProfile()</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        <span class="keywordflow">if</span> (is_null($uid))</div>
<div class="line">                <span class="keywordflow">return</span> <span class="stringliteral">&#39;fineuploader/avatars/&#39;</span>;</div>
<div class="line">        <span class="keywordflow">else</span></div>
<div class="line">                <span class="keywordflow">return</span> <span class="stringliteral">&#39;fineuploader/avatars/user&#39;</span>. $uid .<span class="stringliteral">&#39;.jpg&#39;</span>;</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a6e25cefab90ef44a1ae9cbfb47ad4f22"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">getGraduationYearOptions </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$withComment</em> = <code>false</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="profile_8php_source.html#l00436">436</a> of file <a class="el" href="profile_8php_source.html">profile.php</a>.</p>

<p>Referenced by <a class="el" href="profile_8php_source.html#l00084">actionEditProfile()</a>, and <a class="el" href="profile_8php_source.html#l00015">actionShowProfile()</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        <span class="comment">// I decided not to use the text descriptions anymore, they&#39;re imprecise and confusing.</span></div>
<div class="line">        <span class="comment">// (so this table&#39;s values are not actually used).</span></div>
<div class="line">        $classOptions = array(<span class="stringliteral">&#39;3. gimnazjum &#39;</span>, <span class="stringliteral">&#39;1. klasa liceum&#39;</span>,<span class="stringliteral">&#39;2. klasa liceum &#39;</span>, <span class="stringliteral">&#39;3. klasa liceum&#39;</span>,</div>
<div class="line">                <span class="stringliteral">&#39;I rok studiów&#39;</span>, <span class="stringliteral">&#39;II  rok studiów&#39;</span>, <span class="stringliteral">&#39;III rok studiów&#39;</span>, <span class="stringliteral">&#39;IV rok studiów&#39;</span>, <span class="stringliteral">&#39;V rok studiów&#39;</span>);</div>
<div class="line">        $date = getdate();</div>
<div class="line">        $year = $date[<span class="stringliteral">&#39;year&#39;</span>]+3; <span class="comment">// The first element of $classOptions graduates in 3 years.</span></div>
<div class="line">        <span class="keywordflow">if</span> ($date[<span class="stringliteral">&#39;mon&#39;</span>]&gt;=9)</div>
<div class="line">                $year++; <span class="comment">// We consider the 1st of September to be the threshold (should we?).</span></div>
<div class="line">        $graduationYearOptions = array();</div>
<div class="line">        <span class="keywordflow">foreach</span> ($classOptions as $i=&gt;$opt)</div>
<div class="line">        {</div>
<div class="line">                $s = $year;</div>
<div class="line">                <span class="keywordflow">if</span> ($withComment)  $s .= <span class="stringliteral">&quot; (~$opt)&quot;</span>;</div>
<div class="line">                $graduationYearOptions[$year] = $s;</div>
<div class="line">                $year--;</div>
<div class="line">        }</div>
<div class="line">        <span class="keywordflow">return</span> $graduationYearOptions;</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Sun Sep 8 2013 17:44:57 for wwwApp by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.1.1
</small></address>
</body>
</html>
